package com.doitnow.pets.controllor;

import com.doitnow.pets.dao.DictDao;
import com.doitnow.pets.entity.Dict;
import com.doitnow.pets.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/dict")
public class DictControllor {
    @Autowired
    private DictService dictService;

    @RequestMapping(value = "/selectAllDict",method = RequestMethod.GET)
    public Map<String,Object> hello1(){
        Map<String,Object> result = new HashMap<String,Object>();
        result.put("dictList",dictService.selectDictList());
        return result;
    }

    @RequestMapping(value = "/getDictById",method = RequestMethod.GET)
    public Map<String,Object> getDictById(Long id){
        Map<String,Object> result = new HashMap<String,Object>();
        result.put("dict",dictService.getDictById(id));
        return result;
    }
}
